<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt"%>
<%@ taglib uri="/WEB-INF/tld/security.tld" prefix="s"%>
	 
	<script type="text/javascript">
		var filesSize = <bean:write name="FILES_NUMBER"/>;
		function checkAll(){
			var all = document.getElementById('selectAll');
			
				for(x = 0; x < filesSize; x++){					
					var check = document.getElementById("selectedFile" + x);
					if(all.checked != null && all.checked == true){
						check.checked = true;
					}else{
						check.checked = false;
					}					
											
				}
			 
		}
	</script>



<html:form action="/sapFileImport" method="POST">
	<table>
	<tr>
	<td>
	<table align="center" width="400" cellpadding="2" cellspacing="1"
		border="0" bgcolor="#CCCCC0">
		
		<tr>
			<td align="center" class="titulocolumna">			
				<input type="checkbox" onclick="checkAll()" name="selectAll" id="selectAll" />
				<bean:message key="label.sapfiles.table.selectall"></bean:message></td>
			<td width="50" class="titulocolumna"><bean:message
				key="label.sapfiles.table.description"></bean:message></td>
			<td width="50" class="titulocolumna"><bean:message
				key="label.sapfiles.table.system"></bean:message></td>
			<td width="150" class="titulocolumna"><bean:message
				key="label.sapfiles.table.recordsinfile"></bean:message></td>
			<td width="50" class="titulocolumna"><bean:message
				key="label.sapfiles.table.importedrecords"></bean:message></td>

		</tr>
		<logic:notEmpty name="SAPFileForm" property="files">
			<logic:iterate id="file" name="SAPFileForm" property="files" indexId="int_i">
				<tr class="<%=((int_i.intValue() % 2) == 0 ? "columnadatoPar" : "columnadatoNon")%>">
					<logic:equal name="file" property="exist" value="true">
					<td align="center">
					<input type='checkbox' name='selectedFiles' value='<bean:write name="file" property="className" />'
						id='selectedFile<%=int_i.intValue()%>' />
						
						
					</td>
					</logic:equal>
					<logic:equal name="file" property="exist" value="false">
						<td>
							&nbsp;
						</td>
					</logic:equal>
					<td align="left"><bean:write name="file" property="logicalFileName" /></td>					
					<td align="left"><bean:write name="file" property="system" /></td>
					<td align="right"><bean:write name="file" property="recordsInFile" /></td>
					<td align="left"><bean:write name="file" property="importedRecords" /></td>

				</tr>
			</logic:iterate>
		</logic:notEmpty>
	</table>
	</td>
	</tr>
	<tr>
	<td>
	<table align="center">
		<tr>
			<td><html:text property="path" size="40"></html:text></td>
		</tr>
		<tr>
			<td><html:submit styleClass="boton">
				<bean:message key="label.sapfiles.table.import" />
			</html:submit></td>
			<td><input type="button"
				value="<bean:message key="label.sapfiles.table.cancel"/>"
				onclick="location.href = 'sapFileList.do';" class="boton" /></td>
		</tr>
	</table>
	</td>
	</tr>
	</table>
</html:form>

